
package cn.com.spic.demo.impl;

import cn.com.spic.demo.api.ReportService;
import cn.com.spic.demo.dao.ReportDAO;
import cn.com.spic.demo.dto.*;
import cn.com.spic.demo.po.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

@Service
public class ReportServiceImpl implements ReportService {

    @Autowired
    private ReportDAO reportDAO;

    @Override
    public void insertReport(ReportDTO reportDTO) {
        reportDAO.insertReport(reportDTO);
    }

    @Override
    public void updateReport(ReportDTO reportDTO) {
        reportDAO.updateReport(reportDTO);
    }

    @Override
    public ReportDTO getReportByCondition(Map<String, String> map) {
        ReportPO reportPO = reportDAO.getReportByCondition(map);
        ReportDTO reportDTO = new ReportDTO();
        if (reportPO != null) {
            BeanUtils.copyProperties(reportPO, reportDTO);
        }
        return reportDTO;
    }
}

